home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ifp1s158.zip / PAGE_15.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-15  |  6KB  |  215 lines

  1. unit page_15;
  2.  
  3. interface
  4.  
  5. uses crt, ifpglobl, ifpcomon;
  6.  
  7. procedure page15;
  8.  
  9. implementation
  10.  
  11. procedure page15;
  12.  
  13. var
  14.   drive : byte;
  15.   j : 0..3;
  16.   k : byte;
  17.   Part : array[0..secsiz - 1] of byte;
  18.   EndOfDrives : boolean;
  19.   ValidDrive : boolean;
  20.   LastDrive : boolean;
  21.   AnotherDrive : boolean;
  22.   xbyte : byte;
  23.   xlong : longint;
  24.   xword : word;
  25.   s: string;
  26.  
  27.   begin
  28.   caption2('Partition table data');
  29.   if ReadPartitionTable then
  30.     begin
  31.     drive:=$80;
  32.     EndOfDrives:=false;
  33.     ValidDrive:=false;
  34.     repeat
  35.       with regs do
  36.         begin
  37.         AX:=$0201;
  38.         CX:=$0001;
  39.         DX:=drive;
  40.         ES:=Seg(Part);
  41.         BX:=Ofs(Part);
  42.         Intr($13, regs);
  43.         if NoCarry(regs) then
  44.           begin
  45.           EndOfDrives:=true;
  46.           ValidDrive:=true
  47.           end
  48.         else
  49.           if drive < $99 then
  50.             Inc(drive)
  51.           else
  52.             EndOfDrives:=true
  53.         end
  54.     until EndOfDrives;
  55.     if ValidDrive then
  56.       begin
  57.       Writeln;
  58.       caption3('Unit');
  59.       Writeln;
  60.       caption3('Partition');
  61.       Writeln;
  62.       caption3('Bootable');
  63.       Writeln;
  64.       caption3('Starting head');
  65.       Writeln;
  66.       caption3('Starting sector');
  67.       Writeln;
  68.       caption3('Starting cylinder');
  69.       Writeln;
  70.       caption3('System ID');
  71.       Writeln;
  72.       caption3('Ending head');
  73.       Writeln;
  74.       caption3('Ending sector');
  75.       Writeln;
  76.       caption3('Ending cylinder');
  77.       Writeln;
  78.       caption3('First partition sector');
  79.       Writeln;
  80.       caption3('Sectors in partition');
  81.       Writeln;
  82.       LastDrive:=false;
  83.       repeat
  84.         Window(9, 4, twidth, tlength - 2);
  85.         Writeln(drive);
  86.         Window(27, 5, twidth, tlength - 2);
  87.         ClrScr;
  88.         for j:=0 to 3 do
  89.           begin
  90.           Window(27 + 12 * j, 5, 38 + 12 * j, tlength - 2);
  91.           Writeln(j + 1);
  92.           xword:=$01BE + j shl 4;
  93.           xbyte:=Part[xword];
  94.           case xbyte of
  95.             $00 : Writeln('no');
  96.             $80 : Writeln('yes')
  97.           else
  98.               Writeln('(', hex(xbyte, 2), ')')
  99.           end;
  100.           xbyte:=Part[xword + 4];
  101.           if xbyte > $00 then
  102.             begin
  103.             Writeln(Part[xword + 1]);
  104.             Writeln(Part[xword + 2] and $3F);
  105.             Writeln(Part[xword + 3] +
  106.               word(Part[xword + 2] shr 6 * 256));
  107.             s:='';
  108.             case xbyte of
  109.               $00 : s:='None';
  110.               $01 : s:='DOS-12';
  111.               $02 : s:='XENIX root';
  112.               $03 : s:='XENIX /usr';
  113.               $04 : s:='DOS-16';
  114.               $05 : s:='Ext DOS-16';
  115.               $06 : s:='Big DOS-16';
  116.               $07 : s:='OS/2 HPFS';
  117.               $08 : s:='AIX data';
  118.               $09 : s:='AIX boot';
  119.               $0A : s:='OS/2 BtMngr';
  120.               $10 : s:='OPUS';
  121.               $24 : s:='NEC DOS 3.x';
  122.               $40 : s:='VENIX 286';
  123.               $44 : s:='386BSD';
  124.               $50 : s:='DskMngrR/O';
  125.               $51 : s:='Dsk Managr';
  126.               $52 : s:='CP/M';
  127.               $56 : s:='GB Vfeatre';
  128.               $61 : s:='Speedstor';
  129.               $63 : s:='SysV/386';
  130.               $64 : s:='NOVELL';
  131.               $75 : s:='PC/IX';
  132.               $80 : s:='Minix v1.3-';
  133.               $81 : s:='Minix v1.4+';
  134.               $82 : s:='Minix Swap';
  135.               $83 : s:='Linux extd';
  136.               $84 : s:='OS/2 hidden';
  137.               $93 : s:='Amoeba file';
  138.               $94 : s:='Amoeba BBT';
  139.               $B7 : s:='BSDI file';
  140.               $B8 : s:='BSDI swap';
  141.               $C1 : s:='DRDOSscr12b';
  142.               $C4 : s:='DRDOSscr16b';
  143.               $C6 : s:='DRDOSscrHug';
  144.               $C7 : s:='Cyrnix boot';
  145.               $DB : s:='CP/M';
  146.               $E1 : s:='SpdStr-12';
  147.               $E3 : s:='SpdStr R/O';
  148.               $E4 : s:='SpdStr-16';
  149.               $F2 : s:='DOS secndry';
  150.               $FE : s:='LANstep';
  151.               $FF : s:='Xenix BBT';
  152.             end;
  153.             if s = '' then
  154.               Write('(', hex(xbyte, 2), ')')
  155.             else
  156.               Write(s);
  157.             Writeln;
  158.             Writeln(Part[xword + 5]);
  159.             xbyte:=Part[xword + 6];
  160.             Writeln(xbyte and $3F);
  161.             Writeln(cbw(Part[xword + 7], xbyte shr 6));
  162.             xlong:=0;
  163.             for k:=11 downto 8 do
  164.               xlong:=xlong shl 8 + Part[xword + k];
  165.             Writeln(xlong);
  166.             xlong:=0;
  167.             for k:=15 downto 12 do
  168.               xlong:=xlong shl 8 + Part[xword + k];
  169.             Writeln(xlong)
  170.           end
  171.         else
  172.            for k:=1 to 9 do
  173.              Writeln('-')
  174.         end;
  175.         AnotherDrive:=false;
  176.         repeat
  177.           if drive < $99 then
  178.             begin
  179.             Inc(drive);
  180.             with regs do
  181.               begin
  182.               AX:=$0201;
  183.               CX:=$0001;
  184.               DX:=drive;
  185.               ES:=Seg(Part);
  186.               BX:=Ofs(Part);
  187.               Intr($13, regs);
  188.               if NoCarry(regs) then
  189.                 begin
  190.                 AnotherDrive:=true;
  191.                 Pause1;
  192.                 if endit then
  193.                   Exit;
  194.                 end
  195.               end
  196.             end
  197.           else
  198.             begin
  199.             LastDrive:=true;
  200.             AnotherDrive:=true
  201.             end
  202.         until AnotherDrive
  203.       until LastDrive
  204.       end
  205.     else
  206.       Writeln('(no fixed disks)')
  207.     end
  208.   else
  209.     begin
  210.     Writeln;
  211.     Writeln('Reading of Partition Table blocked by NP command-line switch!!');
  212.     end;
  213.   end;
  214. end.
  215.